<template>
  <div>
    <!-- <pre v-html="data"></pre> -->
    <el-form
      :model="regionalChannelUser"
      ref="regionalChannelUser"
      size="mini"
    >
      <el-form-item
        label="选择渠道人员"
        label-width="200px"
        filterable
        prop="userId"
      >
        <el-select
          size="mini"
          v-model="regionalChannelUser.userId"
          filterable
          style="width: 300px;"
        >
          <el-option
            v-for="(item, value) in regionalChannelUserSource"
            :key="value"
            :label="item"
            :value="value"
          >
          </el-option>
        </el-select>
      </el-form-item>
      <div>
        <el-button size="mini" @click="closeDriverDrawer()">取 消</el-button>
        <el-button size="mini" type="primary" @click="saveTemporaryDriver()"
          >保 存</el-button
        >
      </div>
    </el-form>
  </div>
</template>
<script>
import { closeDialog } from "@/utils";
import { ajax } from "@/store/yg/common/utils";
export default {
  props: ["field", "data"],
  data() {
    return {
      regionalChannelUser: {
        ids: [],
        userId:""
      },
      regionalChannelUserSource: [],
    };
  },
  mounted() {
    this.regionalChannelUserSourceMethods();
  },
  methods: {
    regionalChannelUserSourceMethods(){
     ajax("regionalChannelUserSource", this.regionalChannelUser).then(
        res => {
          this.regionalChannelUserSource = res;
        },
        error => {
          console.log(error);
        }
      );
    },
    closeDriverDrawer() {
      closeDialog();
      this.pickUpDriver = {
        id: ""
      };
    },
    saveTemporaryDriver() {
      //保存修改的渠道人员
      this.regionalChannelUser.ids = this.$store.state.edit.ids;
      console.log(this.$store.state.edit);
      ajax("regionalChannelUsersUpdate", this.regionalChannelUser).then(
        res => {
          //console.log(res);
          if (res.code != 200) {
            this.$message.error("保存失败");
          } else {
            this.$message.success("保存成功");
            this.closeDriverDrawer();
            location.reload();
          }
        },
        error => {
          console.log(error);
        }
      );
    },
  }
};
</script>
<style scoped></style>

<style lang="scss">
.row-item {
  color: #3f4652;
  line-height: 28px;
  margin-bottom: 14px;
}

.maxheight {
  display: none;
}
</style>
